//
//  LNTabBar.m
//  LNDevelopExample
//
//  Created by wwww on 2018/9/7.
//  Copyright © 2018年 淘发现1iOS. All rights reserved.
//

#import "LNTabBar.h"
@interface LNTabBar ()
/// divider
@property (nonatomic, readwrite, weak) UIView *divider ;
@end
@implementation LNTabBar

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        /// 去掉tabBar的分割线,以及背景图片
        [self setShadowImage:[UIImage new]];
        
        /// 根据主题设置背景颜色
        LNAppConfigManager *app = [LNAppConfigManager getConfig];
        if (app) {
            NSArray  *clrs = [NSString stringWithColors:app.tabColor];
            UIImage *backImage = [[UIImage alloc]createImageWithSize:CGSizeMake(LN_SCREEN_WIDTH,LN_APPLICATION_TOOL_BAR_HEIGHT_49 ) gradientColors:clrs percentage:@[@(0.5),@(1)] gradientType:GradientFromTopToBottom];
            [self setBackgroundImage:backImage];
        }
        else
            [self setBackgroundImage:[UIImage ln_resizableImage:@"tabbarBkg_5x49"]];
        
//        /// 添加细线,
//        UIView *divider = [[UIView alloc] init];
//        divider.backgroundColor = LNColor(167.0f, 167.0f, 170.0f);
//        [self addSubview:divider];
//        self.divider = divider;
    }
    return self;
}


#pragma mark - 布局
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self bringSubviewToFront:self.divider];
    self.divider.ln_height = LNGlobalBottomLineHeight;
    self.divider.ln_width = LN_SCREEN_WIDTH;
}

@end
